﻿@using System.Globalization
@model store.Areas.Admin.Models.EditCategoryModel
@{
    ViewBag.Title = "Sửa danh mục";
}
<div id="onload">
    <div id="content">
        <div class="contentTop">
            @Html.Partial("_ContentTopPartial")
        </div>

        <!-- Breadcrumbs line -->
        <div class="breadLine">
            <div class="bc">
                <ul id="breadcrumbs" class="breadcrumbs">
                    <li><a href="@Url.Action("Index", "Home")">Trang chủ</a></li>
                    <li><a href="@Url.Action("Index")">Quản lý danh mục</a>
                    </li>
                    <li class="current"><a href="@Url.Action("Create")" title="">Thêm mới danh mục</a></li>
                </ul>
            </div>

            <div class="breadLinks">
                <ul>
                    <li class="has">
                        <a title="">
                            <i class="icos-list"></i>
                            <span>Quản lý danh mục sản phẩm</span>
                            <span>
                                <img src="~/Content/Admin/images/elements/control/hasddArrow.png" alt="" /></span>
                        </a>
                        <ul>
                            <li><a href="@Url.Action("Index")" title=""><span class="icos-archive"></span>Danh sách</a></li>
                            <li><a href="@Url.Action("Create")" title=""><span class="icos-add"></span>Thêm mới</a></li>
                        </ul>
                    </li>
                    <li class="has">
                        <a title="">
                            <i class="icos-list"></i>
                            <span>Quản lý sản phẩm</span>
                            <span>
                                <img src="~/Content/Admin/images/elements/control/hasddArrow.png" alt="" /></span>
                        </a>
                        <ul>

                            <li><a href="@Url.Action("Index")" title=""><span class="icos-archive"></span>Danh sách</a></li>
                            <li><a href="@Url.Action("Create")" title=""><span class="icos-add"></span>Thêm mới</a></li>
                        </ul>
                    </li>
                </ul>
                <div class="clear"></div>
            </div>
        </div>

        <!-- Main content -->
        <div class="wrapper">

            <div class="fluid">
                @using (Html.BeginForm())
                {
                    @Html.AntiForgeryToken()
                    @Html.ValidationSummary(true)
                    <fieldset>
                        <div class="widget">
                            <div class="whead">
                                <h6>Thêm danh mục</h6>
                                <div class="clear"></div>
                            </div>
                            <div class="formRow">
                                <div class="grid3">
                                    <label>Tên danh mục:<span class="req">*</span></label>
                                </div>
                                <div class="grid9">
                                    @Html.EditorFor(model => model.Name)
                                    @Html.ValidationMessageFor(model => model.Name)
                                    @Html.HiddenFor(model => model.CategoryID)
                                </div>
                                <div class="clear"></div>
                            </div>
                            <div class="formRow">
                                <div class="grid3">
                                    <label>Danh mục cha :</label>
                                </div>
                                <div class="grid9">
                                    <select name="ParentID" style="width: 100%" size="10" title="Vui lòng chọn">
                                        @try
                                        {
                                            <option value="0">Bình thường</option>
                                            foreach (var category in (SelectList)ViewBag.Categorys)
                                            {
                                                if (category.Value == Model.ParentID.ToString(CultureInfo.InvariantCulture))
                                                {
                                            <option selected="selected" value="@category.Value">@category.Text</option>
                                                }
                                                else
                                                {
                                            <option value="@category.Value">@category.Text</option>
                                                }

                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                        }

                                    </select>
                                </div>
                                <div class="clear"></div>
                            </div>

                            <div class="formRow">
                                <div class="grid3">
                                    <label>Mô tả:</label>
                                </div>
                                <div class="grid9">
                                    @Html.TextAreaFor(model => model.Description, new { @rows = "8" })
                                    @Html.ValidationMessageFor(model => model.Description)
                                </div>
                                <div class="clear"></div>
                            </div>
                            <div class="formRow">
                                <div class="grid3">
                                    <label>Thứ tự:</label>
                                </div>
                                <div class="grid9">
                                    @Html.TextBoxFor(model => model.Number, new { @style = "width: 50px" })
                                    @Html.ValidationMessageFor(model => model.Number)
                                </div>
                                <div class="clear"></div>
                            </div>
                            <div class="formRow">
                                <div class="grid3">
                                    <label>Hiển thị:</label>
                                </div>
                                <div class="grid9 check">
                                    @Html.CheckBoxFor(model => model.Active)
                                    @Html.ValidationMessageFor(model => model.Active)
                                </div>
                                <div class="clear"></div>
                            </div>
                            <div class="formRow">
                                <table class="fr">
                                    <tr>
                                        <td>
                                            <input type="submit" name="OptionSubmit" value="Lưu" class="buttonM bBlue formSubmit" /></td>
                                        <td>
                                            <input type="submit" name="OptionSubmit" value="Lưu và Thoát" class="buttonM bBlue formSubmit" /></td>
                                        <td>
                                            <input type="reset" value="Làm lại" class="buttonM bDefault formSubmit" /></td>
                                        <td>
                                            <input type="button" onclick="javascript: history.go(-1);" value="Quay lại" class="buttonM bDefault formSubmit" /></td>
                                    </tr>
                                </table>
                                <div class="clear"></div>
                            </div>
                            <div class="clear">
                            </div>
                        </div>
                    </fieldset>
                }
            </div>
        </div>
    </div>
</div>
@section scripts
{
    @Scripts.Render("~/bundles/jqueryval")
}
